package GUI;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Pr1 extends javax.swing.JFrame {
	private JButton Plus;
	private JLabel Op;
	private JLabel Numar2;
	private JLabel Numar1;
	private JLabel R;
	private JLabel Rez;
	private JTextArea Nr1;
	private JTextArea Nr2;
	private JButton Cat;
	private JButton Produs;
	private JButton Minus;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				Pr1 inst = new Pr1();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public Pr1() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				Plus = new JButton();
				Plus.setText("+");
				Plus.addActionListener(new ActionListener () {
				            public void actionPerformed (ActionEvent ae) {
				            	int s, n1, n2;
				            	n1 = Integer.parseInt(Nr1.getText());
				            	n2 = Integer.parseInt(Nr2.getText());
				            	s = 0;
				            	s = n1 + n2;
				            	
				               Rez.setText(Nr1.getText()+" + "+Nr2.getText()+" = "+s);
				            }
				         }
				      );
			}
			
			{
				Minus = new JButton();
				Minus.setText("-");
				Minus.addActionListener(new ActionListener () {
		            public void actionPerformed (ActionEvent ae) {
		            	int d, n1, n2;
		            	n1 = Integer.parseInt(Nr1.getText());
		            	n2 = Integer.parseInt(Nr2.getText());
		            	d = n1 - n2;
		            	
		               Rez.setText(Nr1.getText()+" - "+Nr2.getText()+" = "+d);
		            }
		         }
		      );
			}
			{
				Produs = new JButton();
				Produs.setText("*");
				Produs.addActionListener(new ActionListener () {
		            public void actionPerformed (ActionEvent ae) {
		            	int p, n1, n2;
		            	n1 = Integer.parseInt(Nr1.getText());
		            	n2 = Integer.parseInt(Nr2.getText());
		            	
		            	p = n1 * n2;
		            	
		               Rez.setText(Nr1.getText()+" * "+Nr2.getText()+" = "+p);
		            }
		         }
		      );
			}
			{
				Cat = new JButton();
				Cat.setText("/");
				Cat.addActionListener(new ActionListener () {
		            public void actionPerformed (ActionEvent ae) {
		            	int n1, n2;
		            	float c;
		            	n1 = Integer.parseInt(Nr1.getText());
		            	n2 = Integer.parseInt(Nr2.getText());

		            	c = (float) n1 / n2;
		            	
		               Rez.setText(Nr1.getText()+" / "+Nr2.getText()+" = "+c);
		            }
		         }
		      );
			}
			{
				Nr2 = new JTextArea();
			}
			{
				Nr1 = new JTextArea();
			}
			{
				Numar1 = new JLabel();
				Numar1.setText("Primul numar");
			}
			{
				Numar2 = new JLabel();
				Numar2.setText("Al doilea numar");
			}
			{
				Op = new JLabel();
				Op.setText("Operatii");
			}
			{
				Rez = new JLabel();
			}
			{
				R = new JLabel();
				R.setText("Rezultat");
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(17, 17)
				.addGroup(thisLayout.createParallelGroup()
				    .addComponent(Nr1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
				    .addComponent(Numar1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addGroup(thisLayout.createParallelGroup()
				    .addComponent(Nr2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
				    .addComponent(Numar2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
				.addGap(0, 21, Short.MAX_VALUE)
				.addComponent(Op, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(Minus, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(Cat, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(Plus, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(Produs, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addGap(17)
				.addGroup(thisLayout.createParallelGroup()
				    .addComponent(Rez, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)
				    .addComponent(R, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
				.addContainerGap(35, 35));
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap()
				.addGroup(thisLayout.createParallelGroup()
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(Numar2, GroupLayout.PREFERRED_SIZE, 109, GroupLayout.PREFERRED_SIZE)
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(R, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE)
				                .addGap(22))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addGap(0, 18, Short.MAX_VALUE)
				                .addComponent(Op, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)))
				        .addGap(0, 17, GroupLayout.PREFERRED_SIZE)
				        .addComponent(Rez, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addGroup(thisLayout.createParallelGroup()
				            .addComponent(Numar1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 79, GroupLayout.PREFERRED_SIZE)
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addGap(20)
				                .addComponent(Plus, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE)))
				        .addGap(0, 0, Short.MAX_VALUE)
				        .addComponent(Minus, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE)
				        .addGap(29)
				        .addComponent(Produs, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE)
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(Cat, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE)
				                .addGap(8))
				            .addGroup(thisLayout.createSequentialGroup()
				                .addPreferredGap(Cat, Nr2, LayoutStyle.ComponentPlacement.INDENT)
				                .addGroup(thisLayout.createParallelGroup()
				                    .addComponent(Nr2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
				                    .addComponent(Nr1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE))))))
				.addContainerGap(33, 33));
			pack();
			this.setSize(354, 242);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public JTextArea getNr2() {
		return Nr2;
	}
	
	public JTextArea getNr1() {
		return Nr1;
	}

}
